package com.runtime.hongyunmanage.controller;

import com.runtime.hongyunmanage.utils.CodeUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
public class CodeController {
    @RequestMapping("/code")
    public void code(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        resp.setContentType("image/jpeg"); // 设置响应类型为图片
        CodeUtils.create(120, 40, "jpg", resp.getOutputStream(), req.getSession());
    }
}